<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>角色管理编辑页面</title>
<link rel="stylesheet" href="resource/css/layui.css">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<link rel="stylesheet" href="css/global.css" media="all">
<link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css">
</head>
<body>
	<!-- 		<form class="layui-form" style="margin:15px;" th:object="${mRole}"> -->

<!-- 				<input type="hidden" th:field="*{deleteFlag}"> -->
<div class="layui-fluid">
 <form class="layui-form" th:object="${set}"> 
 <fieldset class="layui-elem-field">
 <legend>轮播图设置</legend>
  	<div class="layui-row layui-col-space10">			
					<input type="hidden" th:field="*{id}">
<!-- 					<input type="hidden" th:field="*{createUserId}"> -->
					 <div class="layui-col-md4">
					   <div class="layui-inline layui-upload" data-id="1" >
						<button type="button" class="layui-btn" id="test1">轮播图1</button>
						  	<input type="hidden" th:field="*{img1}" name="img1" id="img1" />
						    <img class="layui-upload-img"  th:src="*{img1}" id="demo1" style="width:80%">
						    <p id="demoText1"></p>
						</div>
					 </div>
					
	
		 			<div class="layui-col-md4">
			 			 <div class="layui-inline layui-upload" data-id="2">
							<button type="button" class="layui-btn" id="test2">轮播图2</button>
							  	<input type="hidden" th:field="*{img2}" name="img2"  id="img2" />
							    <img class="layui-upload-img"  th:src="*{img2}" id="demo2" style="width:80%">
							    <p id="demoText2"></p>
						</div>
					</div>
					
	
				<div class="layui-col-md4">
					<div class="layui-inline layui-upload" data-id="3" >
						<button type="button" class="layui-btn" id="test3">轮播图3</button>
						  	<input type="hidden" th:field="*{img3}" name="img3" id="img3"/>
						    <img class="layui-upload-img" th:src="*{img3}" id="demo3" style="width:80%">
						    <p id="demoText3"></p>
					</div>
 				</div>
			
 		</div>
 		
 			<div class="layui-row" style="padding-top: 20px">
 			  	 <div class="layui-col-md12">
   					<div class="layui-input-block" style="text-align:center;">
						<button class="layui-btn" lay-submit lay-filter="updateImg">保存</button>
				 	</div>
			   </div>
			</div>
	</fieldset>
</form> 
</div>


<div class="layui-fluid">
 <fieldset class="layui-elem-field">
  <legend>公司信息</legend>
<form class="layui-form" th:object="${set}"> 
					<input type="hidden" th:field="*{id}">
  	<div class="layui-row layui-col-space10">
	   <div class="layui-form-item">
		  <div class="layui-inline">
		    <label class="layui-form-label">公司名称:</label>
		    <div class="layui-input-inline">
		      <input type="text" th:field="*{corporateName}" lay-verify="title" autocomplete="off" placeholder="请输入公司名称" class="layui-input">
		    </div>
		  </div>

		  <div class="layui-inline">
		    <label class="layui-form-label">公司联系人:</label>
		    <div class="layui-input-inline">
		      <input type="text"  lay-verify="title" autocomplete="off" placeholder="请输入联系人" class="layui-input">
		    </div>
		  </div>
		 </div>
		 <div class="layui-form-item">
		   <div class="layui-inline">
		    <label class="layui-form-label">公司电话:</label>
		    <div class="layui-input-inline">
		      <input type="text" th:field="*{phone}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-inline">
		    <label class="layui-form-label">公司邮箱:</label>
		    <div class="layui-input-inline">
		      <input type="text" th:field="*{email}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
		    </div>
		  </div>
		  </div>
	  	<div class="layui-form-item">
		   <div class="layui-inline">
		    <label class="layui-form-label">公司地址名称:</label>
		    <div class="layui-input-inline">
		      <input type="text" th:field="*{addressName}" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
		    </div>
		  </div>
		 </div>
		 
		<div class="layui-form-item">
		    <label class="layui-form-label">公司详细地址:</label>
		    <div class="layui-input-block">
		      <input type="text"  th:field="*{address}" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
		    </div>
		 </div>
 	</div>
 		
 			<div class="layui-row" style="padding-top: 20px">
 			  	 <div class="layui-col-md12">
   					<div class="layui-input-block" style="text-align:center;">
						<button class="layui-btn" lay-submit lay-filter="some">保存</button>
				 	</div>
			   </div>
			</div>
	</form> 			
	</fieldset>
</div>


<div class="layui-fluid">

 <fieldset class="layui-elem-field">
  <legend>其他信息</legend>
<form class="layui-form" th:object="${set}"> 
					<input type="hidden" th:field="*{id}">
  	<div class="layui-row layui-col-space10">
	   <div class="layui-form-item">
			 <div class="layui-inline layui-upload" data-id="4" >
				<button type="button" class="layui-btn" id="test4">关于我们大图</button>
					<input type="hidden"  th:field="*{profileImg}"  id="img4"/>
					<img class="layui-upload-img" th:src="*{profileImg}" id="demo4" style="width:30%">
					<p id="demoText4"></p>
			</div>
		 </div>
		 <div class="layui-form-item">
			 <div class="layui-inline layui-upload" data-id="5" >
				<button type="button" class="layui-btn" id="test5">加入我们大图</button>
					<input type="hidden" th:field="*{joinusImg}"  id="img5"/>
					<img class="layui-upload-img" th:src="*{joinusImg}" id="demo5" style="width:30%">
					<p id="demoText5"></p>
			</div>
		 </div> 
		  <div class="layui-form-item">
		  	 <label class="layui-form-label">公司简介文本:</label>
			 <div class="layui-inline" id="editor" th:text="${set.corporateProfile}">
				 
			</div>
		 </div>
 	</div>
 			<div class="layui-row" style="padding-top: 20px">
 			  	 <div class="layui-col-md12">
   					<div class="layui-input-block" style="text-align:center;">
						<button class="layui-btn" lay-submit lay-filter="other">保存</button>
				 	</div>
			   </div>
			</div>
	</form> 
	</fieldset>
</div>

	<script src="resource/layui.js"></script>
	<script src="js/setting.js"></script>
	<script src="./mobile/js/jquery-2.1.4.js"></script>
	
	<script type="text/javascript" src="js/wangEditor.js"></script>
    <script type="text/javascript">
        var E = window.wangEditor
        var editor = new E('#editor')
        // 或者 var editor = new E( document.getElementById('editor') )
        editor.create()
    </script>
	
	<script type="text/javascript">

	layui.use('upload', function(){
		  var $ = layui.jquery
		  ,upload = layui.upload;
 		
		  $(".layui-upload").each(function(){
			  var dataid =$(this).attr("data-id");
			  var test ="#test"+dataid;
			  var demo ="#demo"+dataid;
			  var demoText ="#demoText"+dataid;
			  var img ="#img"+dataid;
			  var uploadInst = upload.render({
				    elem: test
				    ,url: 'http://47.97.126.57:8082/formpostmultipar'
				    ,before: function(obj){
				      //预读本地文件示例，不支持ie8
				      obj.preview(function(index, file, result){
				        $(demo).attr('src', result); //图片链接（base64）
				      
				      });
				    }
				    ,done: function(res){

				      //如果上传失败
				      if(res.code > 0){
				        return layer.msg('上传失败');
				      }
				      //上传成功
				      $(img).val(res.data.src)

					  console.log(res);
				    }
				    ,error: function(){
//				    	console.log("asdas");
				      //演示失败状态，并实现重传
				      var demoText = $(demoText);
				      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
				      demoText.find('.demo-reload').on('click', function(){
				        uploadInst.upload();
				      });
				    }
				  });
		  })
	})
		
	</script>
</body>
</html>